outsideworkers <- cvl_lodes_all2 %>%
filter(w_county %in% cvlfips == F)
outsideresidents <- cvl_lodes_all2 %>%
filter(h_county %in% cvlfips == F)
These are the percentile calculations for Virginia counties based on the number of Charlottesville area residents who are employed in that county. These calculations do not include the number of Charlottesville area residents who are employed within the Charlottesville region. For example, the number of people who live in Albemarle County and commute to Charlottesville City are not reflected in this calculations. The bar graphs show the most common and least common work-destination counties for Charlottesville area residents who work outside of the Charlottesville area.
quantile(na.omit(outsideworkers$commutersfromRegion), probs = seq(0, 1, by= 0.05))
## 0% 5% 10% 15% 20% 25% 30% 35% 40% 45%
## 2.00 3.25 5.00 13.50 17.00 24.00 26.50 31.00 37.00 45.25
## 50% 55% 60% 65% 70% 75% 80% 85% 90% 95%
## 63.50 68.25 103.00 126.75 152.50 231.75 344.00 487.75 766.50 1167.50
## 100%
## 3565.00
Bottom 25th percentile (the least common work-destinations for Charlottesville area residents)
# Counties that are in the bottom 25th percentile in terms of number of Charlottesville region residents commuters.
outsideworkers25 <- outsideworkers[which(outsideworkers$commutersfromRegion <= quantile(na.omit(outsideworkers$commutersfromRegion), probs = 0.25)),]
ggplot(outsideworkers25, aes(x = NAME, y = commutersfromRegion))+
geom_bar(stat = 'identity', width = 0.5) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(x = "County", y = "Charlottesville area resident commuters")
Top 75th percentile (the most common work-destinations for Charlottesville area residents who work outside the Charlottesville region)
# Counties that are in the top 75th percentile in terms of number of Charlottesville region residents commuters.
outsideworkers75 <- outsideworkers[which(outsideworkers$commutersfromRegion >= quantile(na.omit(outsideworkers$commutersfromRegion), probs = 0.75)),]
ggplot(outsideworkers75, aes(x = NAME, y = commutersfromRegion))+
geom_bar(stat = 'identity', width = 0.5) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(x = "County", y = "Charlottesville area resident commuters")
These are the percentile calculations for Virginia counties based on the number of Charlottesville area residents who are employed in that county. These calculations do not include the number of Charlottesville area residents who are employed within the Charlottesville region. For example, the number of people who live in Albemarle County and commute to Charlottesville City are not reflected in this calculations. The bar graphs show the most common and least common work-destination counties for Charlottesville area residents who work outside of the Charlottesville area.
quantile(na.omit(outsideresidents$commuterstoRegion), probs = seq(0, 1, by= 0.05))
## 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50%
## 7.0 20.3 24.6 29.9 31.4 40.5 48.0 59.1 70.4 83.4 98.0
## 55% 60% 65% 70% 75% 80% 85% 90% 95% 100%
## 124.6 135.8 183.7 250.4 363.0 423.2 566.9 1030.6 1532.3 3128.0
Bottom 25th percentile (the least common work-destinations for Charlottesville area residents)
# Counties that are in the bottom 25th percentile in terms of number of Charlottesville region workers.
outsideres25 <- outsideresidents[which(outsideresidents$commuterstoRegion <= quantile(na.omit(outsideresidents$commuterstoRegion), probs = 0.25)),]
ggplot(outsideres25, aes(x = NAME, y = commuterstoRegion))+
geom_bar(stat = 'identity', width = 0.5) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(x = "County", y = "Charlottesville area workers")
Top 75th percentile (the most common work-destinations for Charlottesville area residents who work outside the Charlottesville region)
# Counties that are in the top 75th percentile in terms of number of Charlottesville region workers.
outsideres75 <- outsideresidents[which(outsideresidents$commuterstoRegion >= quantile(na.omit(outsideresidents$commuterstoRegion), probs = 0.75)),]
ggplot(outsideres75, aes(x = NAME, y = commuterstoRegion))+
geom_bar(stat = 'identity', width = 0.5) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(x = "County", y = "Charlottesville area workers")
The map offers another way to visualize where Charlottesville area residents commute most often. The counts of Charlottesville area residents who commute to work within the Charlottesville region are excluded from the legend so as to limit the range and allow for easier discrimination between the surrounding counties, but the number of commuters to each of the localities in the Charlottesville region is available by clicking on the locality.
cvl_lodes_all2$res <- ifelse(cvl_lodes_all2$w_county %in% cvlfips, NA, cvl_lodes_all2$commutersfromRegion)
pal <- colorNumeric("plasma", reverse = TRUE, na.color = "lightgray", domain = cvl_lodes_all2$res)
leaflet(cvl_lodes_all2) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = cvl_lodes_all2,
fillColor = ~pal(res),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("County: ", cvl_lodes_all2$NAME, "<br>",
"Number of commuters: ", cvl_lodes_all2$commutersfromRegion)) %>%
addLegend("bottomright", pal = pal, values = cvl_lodes_all2$res,
title = "Number of Cville <br> region resident <br> commuters", opacity = 0.7)